//
//  ZYLine.m
//  Example
//
//  Created by wzp on 2024/8/17.
//

#import "ZYLine.h"
@interface ZYLine ()
@property (nonatomic, assign) CGPoint startPoint;
@property (nonatomic, assign) CGPoint endPoint;
@end

@implementation ZYLine

- (instancetype)initWithStartPoint:(CGPoint)startPoint
                          endPoint:(CGPoint)endPoint
{
    if (self = [super init]) {
        self.startPoint = startPoint;
        self.endPoint = endPoint;
    }
    return self;
}

- (void)drawInContextRef:(CGContextRef)ref color:(UIColor *)color
{
    [color setStroke];
    CGContextMoveToPoint(ref, self.startPoint.x, self.startPoint.y);
    CGContextAddLineToPoint(ref, self.endPoint.x, self.endPoint.y);
    CGContextSetLineWidth(ref, 1.0f);
    CGContextStrokePath(ref);
}
@end
